Skip to content

build(release): show operators the TN release their node runs - #1499

Merged
MicBun merged 1 commit into
mainfrom
tn-version-in-builds
Nov 25, 2026
Merged

MicBun merged 1 commit into
mainfrom
tn-version-in-builds

Conversation

@MicBun

@MicBun MicBun commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

resolves: #1493

Release tarballs and the ghcr image now carry the TN release, its commit and the commit time at link time. A release or image build fails if its kwild reports any other version.

What changes

  • release.yaml builds all four kwild binaries with -ldflags that set TNVersion to the tag without the v, TNCommit to the release commit and TNBuildTime to the commit time.
  • A new release step runs the Linux AMD64 binary and fails unless kwild version --output json and kwild --version print the tag without the v. The other three binaries get the same LDFLAGS.
  • Setup Go reads go.mod instead of 1.22.x. The Go version stays the same: the v2.6.8 release binary already reports go1.25.3, because the toolchain switched to the one in go.mod.
  • deployments/Dockerfile takes TN_VERSION, TN_COMMIT and TN_BUILD_TIME build args and passes them as ldflags. A local build without them reports 0.0.0-dev.
  • publish-node-image.yaml passes the metadata version, github.sha and the commit time. It first builds and loads the image, runs kwild version --output json in it, and only pushes if the version matches.
  • cmd/version copies TNVersion into kwil-db's KwilVersion when a build sets it. kwild --version, the Starting kwild version log line and kwil_ver in the RPC version methods then report the TN release too.
  • The upgrade guide shows what the version commands print, what 0.10.1 means, and how to read the release from a Docker node's image label. The operator guide links to it.

What each output prints

I built kwild the way release.yaml does, with a test tag v2.6.99:

$ kwild version
 Version:	2.6.99
 Git commit:	d4521cc5f
 Built:		2026-11-25T11:09:15+07:00 (commit time)
 Go version:	go1.25.3
 OS/Arch:	linux/amd64
$ kwild version --output json | jq -c .result
{"version":"2.6.99","git_commit":"d4521cc5f","build_time":"2026-11-25T11:09:15+07:00 (commit time)","go_version":"go1.25.3","os":"linux","arch":"amd64"}
$ kwild --version
kwild version 2.6.99
$ kwild start --version
kwild version 2.6.99

On a local node started from that binary:

  • The log says Starting kwild version 2.6.99.
  • user.version returns {"service":"user","api_ver":"0.2.0","major":0,"minor":2,"patch":0,"kwil_ver":"2.6.99"}. chain.version and function.version also return kwil_ver 2.6.99.
  • kwild admin version prints 2.6.99.
  • /api/v1/health/user still reports "version":"0.2.0", and /api/v1/health still reports function 0.1.0 and user 0.2.0.

The same build without the ldflags, which is how releases build today, prints 0.10.1 in all of these places.

The image built with the new build args gives the same JSON from docker run --rm --entrypoint /app/kwild <image> version --output json, and its org.opencontainers.image.version label reads 2.6.99.

Why setting KwilVersion is safe

I looked for every reader of kwil-db's version.KwilVersion and of kwil_ver in kwil-db at the commit node pins, in node itself, the gateway, sdk-go, sdk-js, sdk-py, kwil-js and the indexer. Every reader only prints or returns the value, and none of them compares or parses it.

  • Only 8 files in kwil-db import its version package. They are the cobra --version, the startup log, the version command and the four RPC version handlers. Nothing in consensus, peers, block sync, state sync, snapshots or migrations imports it.
  • Peers are filtered by a chain ID protocol. The libp2p agent version appears only in a log line, and kwil-db sets no user agent, so that value is not KwilVersion either.
  • The gateway's backend version check reads the version field of /api/v1/health/user. That field is the user service API version, 0.2.0, and this change leaves it alone.
  • The SDKs, kwil-js and the indexer have no reader of kwil_ver or KwilVersion.

The kwil-db code I read for this:

I set KwilVersion in an init() in node rather than with a second -X flag. Each build then has one value to stamp, and a rename in kwil-db breaks the build instead of silently doing nothing.

Checks I ran

  • The release.yaml steps run locally with tag v2.6.99 on this commit: the check passes. The same build without ldflags fails it with kwild version prints '0.10.1', but the release is '2.6.99'.
  • docker build -f deployments/Dockerfile with the new build args, then the image check: passes. A build without the args reports 0.0.0-dev.
  • scripts/build/binary, which task build runs, prints the git describe version (2.6.8-5-gd4521cc5). Before this change, kwild --version printed 0.10.1 for that build.
  • A local node on Postgres: the log line, the RPC version methods, kwild admin version and the health endpoints, as listed above.
  • actionlint 1.7.7 on both workflows, go build ./..., go vet ./cmd/... ./app/... and gofmt -l: clean.

A manual image build from main stamps the metadata version (latest or sha-<7>) as its kwild version. The commit is still the real one.

Review in Wizard

Read and comment on these documents without using GitHub:

Summary by CodeRabbit

  • Bug Fixes

    • Version information is now consistent across release binaries and Docker images, making it easier to confirm which release is running.
  • Documentation

    • Updated node reset and upgrade guides with examples for checking version output, including guidance for source builds and Docker-based nodes.
    • Clarified how to interpret version numbers reported by older binaries.

@MicBun MicBun self-assigned this Nov 25, 2026
@holdex

holdex Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Time Submission Status

Member # Time Running Total Status Last Update
MicBun 2h ✅ Submitted Nov 25, 2026, 4:54 AM

Submit or update total time with:

@holdex pr submit-time 2h

Add time on top of previous submission with:

@holdex pr add-time 1h30m

See available commands to help comply with our Guidelines.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Release and Docker builds now embed TN release, commit, and build-time metadata. Version initialization exposes the TN release through kwil-db’s version value when configured. Release and image workflows check version output, and the guides explain version formats and Docker release identification.

Changes: Release Version Reporting

Layer / File(s) Summary
Version reporting and Docker build
cmd/version/utils.go, deployments/Dockerfile, docs/node-operator-guide.md, docs/node-upgrade-guide.md
Version initialization assigns TNVersion to kwilVersion.KwilVersion when set. The Docker build links release metadata into the binary. The guides describe version output, older binaries, and Docker release identification.
Release binary stamping and checks
.github/workflows/release.yaml
The release workflow derives the Go version from go.mod and passes version, commit, and build-time linker flags to platform builds. It checks Linux AMD64 version output before packaging.
Node image build and version check
.github/workflows/publish-node-image.yaml
The image workflow captures commit time, builds an image with release metadata, checks its JSON version, and passes the same metadata to the push build.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature · Severity of issue fixed: Medium

Suggested reviewers: outerlook, chappjc

Merge Risk: Minimal · up to d4521

This change makes release binaries and images report the TN release version and commit, and fails builds on a mismatch. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "build(release): show operators the TN release their node runs" matches the main change. The PR stamps release binaries and container images with the TN release, commit, and commit time, and…
Linked Issues check Passed Issue #1493 has one directly linked target, and it has coding requirements. (1) Release binaries and images carry the TN version and commit. .github/workflows/release.yaml sets LDFLAGS with `TNVer…
Out of Scope Changes check Passed All changed files map to #1493 objectives. release.yaml and publish-node-image.yaml stamp and verify the version. deployments/Dockerfile accepts build args for the image. cmd/version/utils.go …
Full details: Title check

Explanation

The title "build(release): show operators the TN release their node runs" matches the main change. The PR stamps release binaries and container images with the TN release, commit, and commit time, and adds a check that fails builds when the reported version differs from the tag. The title names the operator-facing goal, which the linked issue #1493 also requests. It is specific and follows conventional commit style, so it passes.

Full details: Linked Issues check

Explanation

Issue #1493 has one directly linked target, and it has coding requirements. (1) Release binaries and images carry the TN version and commit. .github/workflows/release.yaml sets LDFLAGS with TNVersion, TNCommit and TNBuildTime for all four builds. The Dockerfile and publish-node-image.yaml pass the same values (per PR summary). (2) kwild version, kwild --version, the startup log and user.version report the release. At head, cmd/version/utils.go init() sets kwilVersion.KwilVersion to TNVersion when it is set. The version command reads TNVersion through getVersion(), and the RPC kwil_ver reads KwilVersion. (3) A release fails when its binary reports another version. The release workflow checks kwild version --output json and kwild --version against $VERSION on the Linux AMD64 binary and exits 1 on mismatch. (4) Health endpoints keep their API versions. The change only sets KwilVersion and does not alter the health handlers, per the PR description. (5) Guides explain the version output and Docker label lookup, per the upgrade and operator guide changes. Runtime results (node log, RPC output, image label, release check run) are author-reported and were not re-executed here. The code evidence supports each requirement.

Full details: Out of Scope Changes check

Explanation

All changed files map to #1493 objectives. release.yaml and publish-node-image.yaml stamp and verify the version. deployments/Dockerfile accepts build args for the image. cmd/version/utils.go copies TNVersion into KwilVersion. The docs cover the version output. The setup-go change from 1.22.x to go-version-file: go.mod is a build-environment change in the release workflow. The PR description states the Go version is unchanged, so it stays within the release build scope. No unrelated change was found in the reviewed files.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 12627e2a-4bdd-4d5f-932b-a24b6c6e0158
Commits

Reviewing files that changed from the base of the PR and between 9e00868 and d4521cc.

Files selected for processing: 6

  • .github/workflows/publish-node-image.yaml
  • .github/workflows/release.yaml
  • cmd/version/utils.go
  • deployments/Dockerfile
  • docs/node-operator-guide.md
  • docs/node-upgrade-guide.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@MicBun

MicBun commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@holdex pr submit-time 2h

@MicBun
MicBun merged commit d7b2442 into main Nov 25, 2026
12 checks passed
@MicBun
MicBun deleted the tn-version-in-builds branch November 25, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem: operators can't tell which TN release their node runs

1 participant